package com.woniu.mapper;

import com.woniu.been.entity.News;
import com.woniu.been.entity.vo.NewsVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface NewsMapper {
    List<NewsVo> findAllNews(NewsVo newsVo) ;

    @Delete("delete from news where id = #{id}")
    void deleteNews(Integer id);

    @Select("select distinct create_name from news")
    List<String> queryOperNameList();

    void insertNews(News news);

    @Update("update news set title=#{title},content=#{content},amend_time=now(),amend_name=#{amendName} where id=#{id}")
    void updateNewsById(News news);

    @Select("select * from news where id = #{id}")
    News findNewsById(Integer id);

}
